import { defineStore } from 'pinia';
import router from '@/router';

export const useParentStore = defineStore('parentId', {
    state: () => ({
        parentName: '',
        studentNum: ''
    }),
    actions: {
        login(data) {
            localStorage.setItem('userType', 'parent');
            this.parentName = data.studentInfoExts[0].name;
            this.studentNum = data.studentInfoExts[0].stuNum;
            router.push({ name: 'home-parent' });
        },
        logout() {
            this.$reset();
        }
    }
});
